<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Alert;

/* @var $this yii\web\View */
/* @var $searchModel app\models\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '学员列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?php if( Yii::$app->getSession()->hasFlash('success') ) {
        echo Alert::widget([
            'options' => [
                'class' => 'alert-success', //这里是提示框的class
            ],
            'body' => Yii::$app->getSession()->getFlash('success'), //消息体
        ]);
    }
    if( Yii::$app->getSession()->hasFlash('error') ) {
        echo Alert::widget([
            'options' => [
                'class' => 'alert alert-danger',
            ],
            'body' => Yii::$app->getSession()->getFlash('error'),
        ]);
    } ?>

    <p>
        <?= Html::a('增加学员', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            'truename',
            'email:email',
            'roles',

            // 'idcard',
            // 'gender',
            // 'birthday',
            // 'city',
            // 'mobile',
            // 'qq',
            // 'company',
            // 'job',
            'class',
            'student_id',
            //'weixin',
            // 'iam',
            // 'loginTime:datetime',
            // 'loginIp',
            // 'createdIp',
            // 'createdTime:datetime',

            ['class' => 'yii\grid\ActionColumn','header' => '操作', 'headerOptions' => ['width' => '80']],
        ],
    ]); ?>

</div>
